<?php
/*
    Id:     $Id: $
    File:   index.php
    Author: John Griffin
    Date:   May 5, 2009

    Description:


    Notes:
        The following names are reserved:
            start       - GET, what record to start returning
            count       - GET, how many records to return
            order       - GET, how to order records for return
            action      - POST, action to perform (POST, PUT, DELETE)
            resource    - ALL, resource being requested
            response    - ALL, what format should the response be in {HTTP, XML, HTML} (should/can I support this globally?)
            
        http://localhost/{resource}/?arg1=a&arg2=b&start=0&count=10
        http://localhost/{resource}/?arg1=a&arg2=b&start=0&count=10&response=XML
            
*/
$dir = dirname(__FILE__);
ini_set ('include_path', $dir.':'.ini_get ('include_path'));

require_once 'lib/REST.php';

if (isset ($_REQUEST['resource']) == true) {
    $resource_file = 'etc/'.$_REQUEST['resource'].'.xml';
    if (file_exists ($resource_file) == true) {
        $rest = new REST ($resource_file);
        $rest->exec ();
    } else {
        header('HTTP/1.0 404 Not Found');
    }
} else {
    // display some sort of available resource information
}
?>
